package com.pro.common.service.sitecontent.service.auth;

import com.pro.common.api.enums.EnumSysRole;
import com.pro.common.modules.service.dependencies.auth.AuthService;
import com.pro.common.modules.service.dependencies.auth.model.TableAuthData;
import com.pro.common.service.sitecontent.model.db.AuthDict;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

@Service
public class AuthDictAuthService extends AuthService<AuthDict> {
    @Override
    public List<TableAuthData<AuthDict>> getConfigs() {
        return List.of(
                TableAuthData.query(
                        a->{
                            return a.getShowUser();
                        }, List.of(EnumSysRole.ANONYMOUS, EnumSysRole.USER, EnumSysRole.AGENT), Arrays.asList(AuthDict::getCode, AuthDict::getValue)),
                TableAuthData.query(a->{
                    return a.getShowAdmin();
                }, List.of(EnumSysRole.ADMIN), null)
        );
    }
}
